package com.puppyrescue;

import org.json.JSONObject;

import android.content.Context;

import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.widget.Toast;



public class Utils {

    private static NetworkInfo networkInfo;

    private static JSONObject jsonObject;

        
   /**
     * Is there internet connection
     */
    public static boolean isConnected(Context context) {

        ConnectivityManager connectivity = (ConnectivityManager)context
                .getSystemService(Context.CONNECTIVITY_SERVICE);

        networkInfo = connectivity.getActiveNetworkInfo();

        if (networkInfo != null && networkInfo.isConnected() && networkInfo.isAvailable()) {
            return true;
        }
        return false;

    }

    /**
     * Show toast
     * 
     * @param Context - the application's context
     * @param Int - string resource id
     * @return void
     */
   public static void showToast(Context context, int i) {
        int duration = Toast.LENGTH_LONG;
        Toast.makeText(context, i, duration).show();
    }

   
       
   

   
}
